import { ObjCreate } from "../../common/ObjCreate";
import { TitleItem } from "../../common/item/TitleItem";
import { Language } from "../../../../../extend/language/Language";
import { ObjTeamCreate } from "../../common/ObjTeamCreate";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { TilePanel } from "../../equipment/TilePanel";
import { ArenaCrossMyScheduleCellRenderer } from "../cellRenderer/ArenaCrossMyScheduleCellRenderer";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { SArenaCrossBattleRecords } from "../../../../../Message/Public/SArenaCrossBattleRecords";
import { DataProvider } from "../../../../../fl/data/DataProvider";
//class ArenaCrossMySchedulePanel
    
    export  class ArenaCrossMySchedulePanel /* flash.display.Sprite */
    {
        constructor()
        {
            
            this.init();
            this.addEventListener(flash.events.Event.ADDED_TO_STAGE, this.onAddToStage);
            return;
        }

        /* internal  */init(): void
        {
            ObjCreate.createSpBannerAndBg(0, 0, 544, 483, "", this);
            var loc1=new Vector.<TitleItem>();
            loc1.push(new TitleItem(Language.getString(44376), 180));
            loc1.push(new TitleItem("", 80));
            loc1.push(new TitleItem(Language.getString(44376), 180));
            loc1.push(new TitleItem(Language.getString(44377), 80));
            var loc2=ObjTeamCreate.createTitles(loc1);
            ObjCreate.setObjAttri(loc2, 2, 8, -1, -1, this);
            this._tfNoResult = ObjCreate.createTextField(Language.getString(44251), 235, 243, 200, 20, this, GlobalStyle.textFormat6);
            this._tfNoResult.visible = false;
            this._topListPanel = new TilePanel();
            this._topListPanel.setSize(540, 450);
            this._topListPanel.rowHeight = 45;
            this._topListPanel.columnWidth = 540;
            this._topListPanel.setStyle("cellRenderer", ArenaCrossMyScheduleCellRenderer);
            this._topListPanel.x = 0;
            this._topListPanel.y = 30;
            this.addChild(this._topListPanel);
            return;
        }

        /* internal  */onAddToStage(arg1: Object /* flash.events.Event */): void
        {
            this.getData();
            return;
        }

        /* internal  */getData(): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.ArenaCrossGetMyBattleRecords));
            return;
        }

        public updateBattles(arg1: SArenaCrossBattleRecords): void
        {
            this._topListPanel.dataProvider = new DataProvider(arg1.records);
            this._topListPanel.drawNow();
            return;
        }

        /* internal */ /* var */_tfNoResult: Object /* flash.text.TextField */;

        /* internal */ /* var */_topListPanel: TilePanel;
    }
